#! /usr/bin/env python
# -*- coding: utf-8 -*-
'''
A module to write scatpairs and additional info to stdout
'''

import os, sys
from plane import Plane
from calculate_scatangle_module import calculate_scateringangle

def write_scatpair(aplane, adir, bplane, bdir, fname):
    isDirAppart, isOneHalf, mscatangle, dscatangle = \
                calculate_scateringangle(aplane, adir, bplane, bdir)

    f = open(fname, 'w')
    f.write("# Pairs is dirrected in OneHalf: %s\n" % isOneHalf)
    f.write("%003d %02d %003d # Scattering angle: %003d\n" % \
                     (aplane.dir, aplane.dip, adir, mscatangle))
    f.write("%003d %02d %003d # Scattering angle: %003d\n" % \
                     (bplane.dir, bplane.dip, bdir, dscatangle))
    f.close
